import Vue from 'vue'
import App from './App.vue'
import { registerMicroApps, start, setDefaultMountApp } from 'qiankun'
import microApps from './micro-app'

Vue.config.productionTip = false

new Vue({
  render: h => h(App)
}).$mount('#app')

// 给子应用配置加上loader方法
const apps = microApps.map(item => {
  return {
    ...item
  }
});

registerMicroApps(apps, {
  beforeLoad: app => {
    console.log('beforeLoad app.name------>', app.name)
  },
  beforeMount: [
    app => {
      console.log('beforeMount %c%s', 'color: green;', app.name)
    }
  ],
  afterMount: [
    app => {
      console.log('afterMount %c%s', 'color: green;', app.name)
    }
  ],
  afterUnmount: [
    app => {
      console.log('afterUnmount %c%s', 'color: green;', app.name)
    }
  ]
});
setDefaultMountApp('/vue1/');
start();